<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

function pre($dados) {
    echo '<div style="color:#000099; background-color: #ffffcc">';
    echo '<pre>';
    var_dump($dados);
    echo '</pre>';
    echo '</div>';
}

function explode_url($url, $qtd = 100) {
    if (strlen($url) > $qtd) {
        return chunk_split($url, $qtd, '<br />');
    } else {
        return $url;
    }
}

/**
 * Base URL
 *
 * Create a local URL based on your basepath.
 * Segments can be passed in as a string or an array, same as site_url
 * or a URL to a file can be passed in, e.g. to an image file.
 *
 * @access	public
 * @param string
 * @return	string
 */
if (!function_exists('base_adm')) {

    function base_adm($uri = '') {
        $CI = &get_instance();
        return $CI->config->base_url('adm/' . ltrim($uri, '/'));
    }

}

/**
 * Base URL
 *
 * Create a local URL based on your basepath.
 * Segments can be passed in as a string or an array, same as site_url
 * or a URL to a file can be passed in, e.g. to an image file.
 *
 * @access	public
 * @param string
 * @return	string
 */
if (!function_exists('base_site')) {

    function base_site($uri = '') {
        $CI = &get_instance();
        return $CI->config->base_url('site/' . ltrim($uri, '/'));
    }

}

/**
 * Base URL
 *
 * Create a local URL based on your basepath.
 * Segments can be passed in as a string or an array, same as site_url
 * or a URL to a file can be passed in, e.g. to an image file.
 *
 * @access	public
 * @param string
 * @return	string
 */
if (!function_exists('base_img_site')) {

    function base_img_site($uri = '') {
        $CI = &get_instance();
        $site = $CI->config->item('site');
        return $CI->config->base_url(rtrim($site['arquivos_dir'], '/') . '/' . ltrim($uri, '/'));
    }

}

/**
 * Base URL
 *
 * Create a local URL based on your basepath.
 * Segments can be passed in as a string or an array, same as site_url
 * or a URL to a file can be passed in, e.g. to an image file.
 *
 * @access	public
 * @param string
 * @return	string
 */
if (!function_exists('base_img_adm')) {

    function base_img_adm($uri = '') {
        $CI = &get_instance();
        $adm = $CI->config->item('adm');
        return $CI->config->base_url(rtrim($adm['arquivos_dir'], '/') . '/' . ltrim($uri, '/'));
    }

}
